import http from '@/utils/axios'
export default {
  getPortletVueCode(url) {
    return http({
      url: url,
      method: 'get',
    })
  },
  getPortletList(pram) {
    return http({
      url: `/management-portal/portlet/getList?pageNo=${pram.pageNo}&pageSize=${pram.pageSize}`,
      method: 'get',
    })
  },
  searchLayoutList(pram) {
    let ul = ''
    if (pram.name) {
      ul += `&name=${pram.name}`
    }
    if (pram.label) {
      ul += `&label=${pram.label}`
    }
    if (pram.categoryId) {
      ul += `&categoryId=${pram.categoryId}`
    }
    if (pram.type) {
      ul += `&type=${pram.type}`
    }
    return http({
      url: `/management-portal/portlet/getList?pageNo=${pram.pageNo}&pageSize=${pram.pageSize}` + ul,
      method: 'get',
    })
  },
  saveLayoutList(pram) {
    return http({
      url: `/management-portal/portlet/add`,
      method: 'post',
      data: pram,
    })
  },
  deletLayoutList(pram) {
    return http({
      url: `/management-portal/portlet/delete?id=${pram}`,
      method: 'post',
    })
  },
  updateLayoutList(pram) {
    return http({
      url: `/management-portal/portlet/update`,
      method: 'post',
      data: pram,
    })
  },
  getCategoryList() {
    return http({
      url: `/management-portal/category/page`,
      method: 'get',
    })
  },
  getALiYunInfo() {
    return http({
      url: `/management-portal/storage/getPostSignature?fileType=image&storageType=oss`,
      method: 'get',
    })
  },
  uploadImg(host, pram) {
    return http({
      url: host,
      method: 'post',
      data: pram,
    })
  },
  getDetail(pram) {
    return http({
      url: `/management-portal/portlet/get`,
      method: 'get',
      params: pram,
    })
  },
}
